﻿using UnityEngine;
using System.Collections;
using ProtoBuf.Message;

namespace Room
{
    public enum BoxState
    {
        Open,
        Closed,
    }

    public class RCAIBox : RCAIBase
    {
        public RoomCharactor player;
        public RoomCharactor box;
        public string boxId;
        public BoxState boxState = BoxState.Closed;
        public RCAIBox(RoomCharactor owner)
            : base(owner)
        {
            box = owner;
            type = AIType.Box;
        }

        public void Init(string boxId ,int state)
        {
            this.player = owner.charactorManager.GetSelfCharactor();
            this.boxId = boxId;
            if (state!=0)
            {
                boxState = BoxState.Open;
            }
        }

        public override void Tick()
        {
            if(boxState == BoxState.Open)
            {
                owner.PlayAnim("open");
            }
        }
    }
}